<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <title>企业信息</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" type="text/css" href="/css/street/street.css"/>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" href="/css/base.css">
    <script src="/lib/jQuery-File-Upload-master/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layer/layer.js?20201106" type="text/javascript" charset="utf-8"></script>
    <script src="/js/street/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/street/base/tablePage1.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <style>
        .M-box .active, .M-box1 .active, .M-box2 .active, .M-box3 .active {
            background: #2f80d1!important;
            border: 1px solid #2b7fe0!important;
            margin: 0 3px!important;
            width: 29px!important;
            height: 29px!important;
            line-height: 29px!important;
            font-size: 12px!important;
        }
        .jump-ipt {
            margin: 0 3px;
            width: 28px;
            height: 26px;
            line-height: 26px;
            font-size: 12px;
        }
        .M-box a, .M-box1 a, .M-box2 a, .M-box3 a {
            margin: 0 3px!important;
            width: 29px!important;
            height: 29px!important;
            line-height: 29px!important;
            font-size: 12px!important;
        }
        td a{
            margin-right: 10px;
        }
        table td{
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        body{
            background-color: #f7f7f7;
        }
        .header{
            background-color: #f7f7f7;
        }
        .formHead{
            height: 40px;
        }
        .formHead span{
            line-height:40px;
        }
        .formbox{
            border: 1px solid #dedede;
            width: 900px;
            background-color: #fff;
            margin: 0 auto;
            border-radius: 2px;
            padding: 0 20px;
            padding-bottom: 10px;
        }
        .spans1{
            height: 20px;
            border-left: 7px solid #2b7ee0;
            margin-right: 5px;
            display: inline-block;
            position: absolute;
            top: 11px;
        }
        .span1title{
            height: 40px;
            display: inline-block;
            font-size: 18px;
            margin-left: 15px;
            font-weight: 600;
            color: #151515;
        }
        .secondtitle{
            height: 40px;
            line-height: 40px;
            margin-top: 15px;
            position: relative;
            z-index: 998;
        }
        .secondtitlespan{
            position: absolute;
            z-index: 99999;
            font-size: 16px;
            color: #2b7ee0;
            font-weight: 600;
            background-color: #fff;
        }
        .line{
            width: 100%;
            height: 20px;
            border-bottom: 1px dashed #ccc;
            position: relative;
            z-index: 900;
        }
        .formbox td{
            position: relative;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            color: #424242;
            font-weight: 600;
            padding: 5px 10px;
            text-align: right;
        }
        .longText{
            width: 100%;
            border: 1px solid #d6d6d6;
            background-color: #f7f7f7;
            -webkit-border-radius: 6px;
            -moz-border-radius:6px;
            border-radius:6px;
            text-indent: 10px;
        }
        .selectbox{
            width: 100%;
            border: 1px solid #d6d6d6;
            background-color: #f7f7f7;
            -webkit-border-radius: 6px;
            -moz-border-radius:6px;
            border-radius:6px;
        }
        .dwbtn{
            position: absolute;
            width: 60px;
            height: 30px;
            background-color: #228cdc;
            color: #fff;
            right: -57px;
            border-radius: 3px;
            cursor: pointer;
            top: 11px;
        }
        .lastbtn{
            width: 100px;
            height: 30px;
            background-color: #228cdc;
            color: #fff;
            border-radius: 5px;
            cursor: pointer;
        }
        .img_box{
            font-weight: 500;
        }
        .spantextbox li{
            height: 30px;
            line-height: 30px;
        }
        .spantextbox li input{
            float: right;
            height: 20px;
            padding: 0;
            margin-top: 5px;
            text-indent: 5px;
            margin-right: 34px;
            width: 158px;
        }
        .header{
            top: 43px;
            border:none;
        }
        .head .headli3{
            width:100px;
        }
        .pagediv th:nth-child(1){
            width:4%;
        }
        .pagediv th:nth-child(2){
            width:4%;
        }
        .pagedivTh th:nth-child(3){
            width: 5%;
        }
        .pagedivTh th:nth-child(4){
            width: 15%;
        }
        .pagedivTh th:nth-child(5){
            width: 10%;
        }
        .pagedivTh th:nth-child(6){
            width: 10%;
        }
        .pagedivTh th:nth-child(7){
            width: 10%;
        }
        .pagedivTh th:nth-child(8){
            width: 12%;
        }
        .pagedivTh th:nth-child(9){
            width: 14%;
        }
        table{
            table-layout: fixed;
        }
        .header{
            padding-left:0px;
        }
        .exportsss {

            width: 80px;
            height: 30px;
            cursor: pointer;
            background-image: url(../../img/import.png);
            padding-left: 25px;
            font-size: 13px;
            background-repeat: no-repeat;
            border-width: initial;
            border-style: none;
            border-color: initial;
            border-image: initial;
        }
        .fileload {
            position: absolute;
            opacity: 0;
            width: 80px;
            right: 615px;
            height: 29px;
            top: 21px;
        }
        .input{
            background: #00a0e9;
            margin-left: 10px;
            padding: 5px 10px;
            border-radius: 4px;
            color: #fff;
            cursor: pointer;
        }
        .newBtn{
            background: url(/img/newjian.png) no-repeat;
            padding-left:5px;
            border:none
        }

    </style>
</head>
<body>
    <div class="head w clearfix" style="height: 42px;">
        <ul class="index_head">
            <li data_id="1"><span class="one headli1_1">
                  一般法人单位
               </span><img class="headli1_2" src="../img/twoth.png" alt="">
            </li>
            <li data_id="2"><span class="headli2_1">
                    小规模法人单位
                </span><img src="../img/twoth.png" alt="" class="headli2_2">
            </li>

            <li data_id="3"><span class="headli3">
                  大型个体工商户
               </span><img src="../img/twoth.png" alt="" class="headli2_2"></li>
            <li data_id="4"><span class="headli4">
                   小型个体工商户
               </span><img src="../img/twoth.png" alt="" class="headli2_2">
            </li>
            <li data_id="5"><span class="headli4">
                   在建工程项目
               </span>
            </li>
        </ul>
    </div>
    <div class="header" style="position: absolute;line-height: 60px; height: 60px;min-width: 850px">
        <img src="/img/icon_unitManagement.png" class="fl" style="margin-top: 17px;">
        <div class="headertitle" style="margin-top: 0;"> 企业信息</div>
        <div style="height: 45px;width: 470px;float: left;line-height: 45px;margin-left: 40px;" class="clearfix">
            <label class="fl" style="margin-top: 16px;">
                <span class="fl" style="margin-top: 5px;">状态类型：</span>
                <select name="checkType" id="ztlx">
                    <%--<option value="">请选择</option>--%>
                    <%--<option value="01">合格达标</option>--%>
                    <%--<option value="02">一般隐患</option>--%>
                    <%--<option value="03">突出隐患</option>--%>
                    <%--<option value="04">重大隐患</option>--%>
                    </select>
                <span style="padding-left:5px;">社区：</span>
                <select name="gridName" id="gridName" style="width:180px;height:28px;border-radius: 3px;float:none"></select>
            </label>

        </div>

        <div class="empty" style="background-color:#2f8ae3">
            <a href="javascript:void (0)" style="text-align: center;line-height: 28px;height: 28px;width: 70px;display: block;margin-top: 17px;" data-type="1" onclick="newbtn($(this))" class="newBtn btnData">新建</a>
        </div>
        <%--<div class="import Query" id="exInport">导入</div>--%>

        <button type="button" class="Query" id="exInport"  style="background-color:#2f8ae3 ">导入</button>
        <button type="button" class="Query " id="searchbtn" onclick="searchfuc($(this))" style="background-color:#2f8ae3 ">查询</button>
    </div>
    <label class="fl" style="margin-top: 16px;">

    </label>

        <%--<div style="margin-top: 20px">
            <form action="/formupload/inputfile" id="fileload" enctype="multipart/form-data" method ="post">
                <input type="button" value="<fmt:message code="workflow.th.Import" />" class="exportsss"  title="导入" >&nbsp;&nbsp;
                <input type="file" name="file" class="fileload" onchange="filechang()">
            </form>
        </div>--%>
    </div>
    <div class="mainData" style="display: block;">
        <div class="pagediv" id="pagediv" style="margin: 0 auto;width: 100%;margin-top: 60px;">
        </div>

        <div id="dbgz_page" class="M-box3 fr" style="margin-top: 10px;display: none;"><span class="active" style="background-color:#2f8ae3 ">1</span><input type="text" class="jump-ipt"><a href="javascript:;" class="jump-btn">跳转</a></div>
    </div>

    <script>
        function getZT(){
            $.ajax({
                url:'/code/getEnterprise',
                type:'get',
                data:'enterprise_TYPE',
                dataType:'json',
                success:function (res) {
                    var str='<option value="">请选择</option>'
                    var data=res.obj;
                    for(var i=0;i<data.length;i++){
                        str += '<option value="'+data[i].codeNo+'">'+data[i].codeName+'</option>'
                    }
                    $('#ztlx').html(str)
                }
            })
            $.get('/code/getCode?parentNo=TYPE_OF_ACCOUNT',function(res){
                var str ='<option value="">请选择</option>'
                var data = res.obj;
                for(var i=0;i<data.length;i++){
                    str += '<option value="'+data[i].codeNo+'">'+data[i].codeName+'</option>'
                }
                $('#gridName').html(str)

            })
        }

        $(function(){
            getZT()
            $('#exInport').click(function(){
                layer.open({
                    type:1,
                    title: ['企业信息导入', 'background-color:#2b7fe0;color:#fff;'],
                    area: ['600px', '420px'],
                    btn: ['导入', '取消'],
                    content:'<div>' +
                    '<form class="form1" name="form1" id="uploadForm" method="post" action="/formupload/inputfile" enctype="multipart/form-data">' +
                    '<table class="importTable"> ' +
                    '<tr><td style="width: 100px;">下载导入模板：</td><td style="text-align: left;"><a id="model" style="cursor:pointer">企业信息模板下载</a></td></tr>' +
                    '<tr> <td>选择导入文件：</td> <td><input style="width: auto" type="file" name="file"/></td> </tr>' +
                    '<tr>' +
                    '<td>说明：</td>'+
                    '<td style="text-align: left;"><p>1、请导入.xls文件或者.xlsx。</p>'+
                    '<p>2、请填写网格信息中已有网格。</p>'+
					 '<p>3、企业类型为必填</p>'+
                    '<p>4、类型:小规模法人单位、小型个体工商户、一般法人单位、<br>在建工程、大型个体工商户</p>'+
                    ' </td> ' +
                    '</tr>' +
                    '</table>' +
                    '</form>' +
                    '</div>',
                    success:function(){
                        $('#model').click(function () {
                            window.location.href = encodeURI("/file/grid/business_account.xls");
                        });
                    },
                    yes:function(obj){
                        var flag = CheckForm();
                        if (flag) {
                            layer.msg("正在导入中，请耐心等候", {icon: 1});
                            $.upload($('#uploadForm'), function (res) {
                                if(res.flag) {
                                    layer.msg("导入成功", {icon: 1});
                                }else{
                                    layer.msg("导入失败", {icon: 2});
                                }
                            });

                            layer.closeAll();
                        }
                    }
                })
            })
        })
        function CheckForm(){
            if(document.form1.file.value==""){
                layer.msg("请选择要导入的文件！",{icon:2});
                return (false);
            }

            return (true);
        }
        /**
         * Created by Mr.center on 2017/11/17 Fri.
         */
        var arr=[
            {
                title:'',
                name:'',
                selectFun:function (data,obj) {
                    return '<div style="width:1%"></div>'
                }
            },
            {
                title:'选择',
                name:'',
                selectFun:function (data,obj) {
                    return '<input type="checkbox" class="checkChild" style="float: none" data-id="'+obj.generalSafetyUnitId+'">'
                }
            },
            {
                title:'序号',
                name:'',
                selectFun:function (data,obj,i) {
                    return (i+1)
                }
            },
            {
                title:'企业名称',
                name:'unitName'
            },
//            {
//                title:'企业性质',
//                name:'',
//                selectFun:function (data) {
//                    if(data == undefined){
//                        return '一般安全生产法人单位';
//                    }
//                }
//            },
            {
                title:'联系人',
                name:'legalRepresentative',

            },
            {
                title:'联系方式',
                name:'mobilePhone',
                selectFun:function (data) {
                    if(data == undefined){
                        return '';
                    }else{
                        return data;
                    }
                }
            },
            {
                title:'企业状态',
                name:'enterpriseState',
                selectFun:function (data) {
                    if(data == undefined|| data == 0){
                        return '';
                    }else if(data == '01'){
                        return '合格达标';
                    }else if(data == '02'){
                        return '一般隐患';
                    }else if(data == '03'){
                        return '突出隐患';
                    }else if(data == '04'){
                        return '重大隐患';
                    }
                }
            },
            {
                title:'注册类型',
                name:'typesOfRegistration',
                selectFun:function (data) {
                    if(data == undefined|| data == 0){
                        return '';
                    }else if(data == '110'){
                        return '国有';
                    }else if(data == '120'){
                        return '集体';
                    }else if(data == '130'){
                        return '股份合作';
                    }else if(data == '141'){
                        return '国有联营';
                    }else if(data == '142'){
                        return '集体联营';
                    }else if(data == '143'){
                        return '国有与集体联营';
                    }else if(data == '149'){
                        return '其他联营';
                    }else if(data == '151'){
                        return '国有独资公司';
                    }else if(data == '159'){
                        return '其他有限责任公司';
                    }else if(data == '160'){
                        return '股份有限公司';
                    }else if(data == '171'){
                        return '私营独资';
                    }else if(data == '172'){
                        return '私营合伙';
                    }else if(data == '173'){
                        return '私营有限责任公司';
                    }else if(data == '174'){
                        return '私营股份有限公司';
                    }else if(data == '190'){
                        return '其他';
                    }else if(data == '210'){
                        return '与港澳台商合资经营';
                    }else if(data == '220'){
                        return '与港澳台商合作经营';
                    }else if(data == '230'){
                        return '港澳台商独资';
                    }else if(data == '240'){
                        return '港澳台商投资股份有限公司';
                    }else if(data == '290'){
                        return '其他港澳台投资';
                    }else if(data == '310'){
                        return '中外合资经营';
                    }else if(data == '320'){
                        return '中外合作经营';
                    }else if(data == '330'){
                        return '外资企业';
                    }else if(data == '340'){
                        return '外商投资股份有限公司';
                    }else if(data == '390'){
                        return '其他外商投资';
                    }
                }
            },
            {
                title:'操作',
                name:''
            }
        ]
        var arr1=[
            {
                title:'',
                name:'',
                selectFun:function (data,obj) {
                    return '<div style="width:1%"></div>'
                }
            },

            {
                title:'选择',
                name:'',
                selectFun:function (data,obj) {
                    return '<input type="checkbox" class="checkChild" style="float: none" data-id="'+obj.smallScaleSecurityUnitId+'">'
                }
            },
            {
                title:'序号',
                name:'',
                selectFun:function (data,obj,i) {
                    return (i+1)
                }
            },
            {
                title:'企业名称',
                name:'unitName'
            },
//            {
//                title:'企业性质',
//                name:'',
//                selectFun:function (data) {
//                    if(data == undefined){
//                        return '小规模安全生产法人单位';
//                    }
//                }
//            },
            {
                title:'联系人',
                name:'legalRepresentative'
            },
            {
                title:'联系方式',
                name:'mobilePhone',
            },
            {
                title:'企业状态',
                name:'enterpriseState',
                selectFun:function (data) {
                    if(data == undefined|| data == 0){
                        return '';
                    }else if(data == '01'){
                        return '合格达标';
                    }else if(data == '02'){
                        return '一般隐患';
                    }else if(data == '03'){
                        return '突出隐患';
                    }else if(data == '04'){
                        return '重大隐患';
                    }
                }
            },
            {
                title:'企业特性',
                name:'enterpriseCharacteristics',
                selectFun:function (data) {
                    if(data == undefined|| data == 0){
                        return '';
                    }else if(data == '1'){
                        return '加工';
                    }else if(data == '2'){
                        return '餐饮';
                    }else if(data == '3'){
                        return '旅馆';
                    }else if(data == '4'){
                        return '仓储';
                    }else if(data == '5'){
                        return '娱乐';
                    }else if(data == '6'){
                        return '商店（超市）';
                    }else if(data == '7'){
                        return '服装';
                    }else if(data == '8'){
                        return '复印';
                    }else if(data == '9'){
                        return '机修';
                    }else if(data == '10'){
                        return '建材';
                    }else if(data == '11'){
                        return '网吧';
                    }else if(data == '12'){
                        return '办公服务类';
                    }else if(data == '13'){
                        return '再生资源回收利用';
                    }else if(data == '14'){
                        return '其他';
                    }
                }
            },
            {
                title:'操作',
                name:''
            }
        ]

        var arr2=[
            {
                title:'',
                name:'',
                selectFun:function (data,obj) {
                    return '<div style="width:1%"></div>'
                }
            },

            {
                title:'选择',
                name:'',
                selectFun:function (data,obj) {
                    return '<input type="checkbox" class="checkChild" style="float: none;" data-id="'+obj.lid+'">'
                }
            },
            {
                title:'序号',
                name:'',
                selectFun:function (data,obj,i) {
                    return (i+1)
                }
            },
            {
                title:'企业名称',
                name:'opName'
            },
//            {
//                title:'企业性质',
//                name:'',
//                selectFun:function (data) {
//                    if(data == undefined){
//                        return '大型安全生产个体工商户';
//                    }
//                }
//            },
            {
                title:'联系人',
                name:'lightnDetect'
            },
            {
                title:'联系方式',
                name:'mobPh',
            },
            {
                title:'企业状态',
                name:'enState',
                selectFun:function (data) {
                    if(data == undefined|| data == 0){
                        return '';
                    }else if(data == '01'){
                        return '合格达标';
                    }else if(data == '02'){
                        return '一般隐患';
                    }else if(data == '03'){
                        return '突出隐患';
                    }else if(data == '04'){
                        return '重大隐患';
                    }
                }
            },
            {
                title:'行业类别',
                name:'majorActivities',
                selectFun:function (data) {
                    if(data == undefined|| data == 0){
                        return '';
                    }else if(data == '01'){
                        return '易燃易爆物品生产经营';
                    }else if(data == '02'){
                        return '危险化学品或易制毒化学品生产经营、运输、储存企业';
                    }else if(data == '03'){
                        return '食品饮料生产经营';
                    }else if(data == '04'){
                        return '乳制品生产经营';
                    }else if(data == '07'){
                        return '互联网上网服务场所、营业性网站、声讯服务业';
                    }else if(data == '08'){
                        return '公共聚集场所经营（餐馆、酒店、宾馆/旅店/足浴、洗浴、按摩场所/美容、理发）';
                    }else if(data == '09'){
                        return '娱乐服务（歌舞厅、演艺厅、影视厅、电子游戏、棋牌）';
                    }else if(data == '10'){
                        return '营利性医疗机构/药品、医疗器械生产经营';
                    }else if(data == '11'){
                        return '种子、农药、化肥生产经营';
                    }else if(data == '12'){
                        return '卫星地面接收设施生产、安装';
                    }else if(data == '13'){
                        return '印刷与复印';
                    }else if(data == '14'){
                        return '图书报刊及音像制品经营';
                    }else if(data == '15'){
                        return '房地产/房地产经纪/建筑施工/室内装饰装修';
                    }else if(data == '16'){
                        return '公共交通、运输服务业';
                    }else if(data == '17'){
                        return '机动车改装、维修及零配件生产';
                    }else if(data == '18'){
                        return '金融、证券及保险';
                    }else if(data == '19'){
                        return '其他';
                    }
                }
            },
            {
                title:'操作',
                name:''
            }
        ]

        var arr3=[
            {
                title:'',
                name:'',
                selectFun:function (data,obj) {
                    return '<div style="width:1%"></div>'
                }
            },
            {
                title:'选择',
                name:'',
                selectFun:function (data,obj) {
                    return '<input type="checkbox" class="checkChild" style="float: none" data-id="'+obj.sid+'">'
                }
            },
            {
                title:'序号',
                name:'',
                selectFun:function (data,obj,i) {
                    return (i+1)
                }
            },
            {
                title:'企业名称',
                name:'opName'
            },
//            {
//                title:'企业性质',
//                name:'',
//                selectFun:function (data) {
//                    if(data == undefined){
//                        return '小型安全生产个体工商户';
//                    }
//                }
//            },
            {
                title:'联系人',
                name:'lightnDetect'
            },
            {
                title:'联系方式',
                name:'mobPh',
            },
            {
                title:'企业状态',
                name:'enState',
                selectFun:function (data) {
                    if(data == undefined|| data == 0){
                        return '';
                    }else if(data == '01'){
                        return '合格达标';
                    }else if(data == '02'){
                        return '一般隐患';
                    }else if(data == '03'){
                        return '突出隐患';
                    }else if(data == '04'){
                        return '重大隐患';
                    }
                }
            },
            {
                title:'行业类别',
                name:'majorActivities',
                selectFun:function (data) {
                    if(data == undefined || data == 0 || data == ''){
                        return '';
                    }else if(data == '01'){
                        return '易燃易爆物品生产经营';
                    }else if(data == '02'){
                        return '危险化学品或易制毒化学品生产经营、运输、储存企业';
                    }else if(data == '03'){
                        return '食品饮料生产经营';
                    }else if(data == '04'){
                        return '乳制品生产经营';
                    }else if(data == '07'){
                        return '互联网上网服务场所、营业性网站、声讯服务业';
                    }else if(data == '08'){
                        return '公共聚集场所经营（餐馆、酒店、宾馆/旅店/足浴、洗浴、按摩场所/美容、理发）';
                    }else if(data == '09'){
                        return '娱乐服务（歌舞厅、演艺厅、影视厅、电子游戏、棋牌）';
                    }else if(data == '10'){
                        return '营利性医疗机构/药品、医疗器械生产经营';
                    }else if(data == '11'){
                        return '种子、农药、化肥生产经营';
                    }else if(data == '12'){
                        return '卫星地面接收设施生产、安装';
                    }else if(data == '13'){
                        return '印刷与复印';
                    }else if(data == '14'){
                        return '图书报刊及音像制品经营';
                    }else if(data == '15'){
                        return '房地产/房地产经纪/建筑施工/室内装饰装修';
                    }else if(data == '16'){
                        return '公共交通、运输服务业';
                    }else if(data == '17'){
                        return '机动车改装、维修及零配件生产';
                    }else if(data == '18'){
                        return '金融、证券及保险';
                    }else if(data == '19'){
                        return '其他';
                    }
                }
            },
            {
                title:'操作',
                name:''
            }
        ]

        var arr4=[
            {
                title:'',
                name:'',
                selectFun:function (data,obj) {
                    return '<div style="width:1%"></div>'
                }
            },
            {
                title:'选择',
                name:'',
                selectFun:function (data,obj) {
                    return '<input type="checkbox" class="checkChild" style="float: none" data-id="'+obj.itemId+'">'
                }
            },
            {
                title:'序号',
                name:'',
                selectFun:function (data,obj,i) {
                    return (i+1)
                }
            },
            {
                title:'项目名称',
                name:'itemName'
            },
//            {
//                title:'企业性质',
//                name:'',
//                selectFun:function (data) {
//                    if(data == undefined){
//                        return '在建工程项目';
//                    }
//                }
//            },
            {
                title: '项目经理',
                name: 'itemManager',
                selectFun: function (data) {
                    if (data == undefined) {
                        return '';
                    }else{
                        return data;
                    }
                }
            },
            {
                title:'联系方式',
                name:'itemManagerno',
            },
            {
                title:'企业状态',
                name:'itemType',
                selectFun:function (data) {
                    if(data == undefined|| data == 0){
                        return '';
                    }else if(data == '01'){
                        return '合格达标';
                    }else if(data == '02'){
                        return '一般隐患';
                    }else if(data == '03'){
                        return '突出隐患';
                    }else if(data == '04'){
                        return '重大隐患';
                    }
                }
            },
            {
                title:'承包方式',
                name:'itemJob'
            },
            {
                title:'操作',
                name:''
            }
        ]
        function newbtn(e){
            var type=$('.one').parent().attr('data_id');
            window.location.href="stoneGardenFigure"+ type ;

//            layer.open({
//                title: '新建企业',
//                btn:['新建','取消'],
//                content: '<ul class="spantextbox"> <li style="position: relative;padding-left: 25px;"><span>企业性质：</span><span><select name="" class="qyxz" style="width: 160px;height: 22px;margin-left: 21px;"><option value="">请选择</option><option value="1">一般安全生产法人单位</option><option value="2">小规模安全生产法人单位</option>><option value="3">大型安全生产个体工商户</option>><option value="4">小型安全生产个体工商户</option>><option value="5">在建工程项目</option></select> </span></li> <li style="position: relative;padding-left: 25px;"><b style="display: inline-block;vertical-align: middle;margin: 5px 5px 0px 5px;color: red">*</b><span>填报人：</span><span><input type="text" name="" class="tbr"></span></li> <li style="position: relative;padding-left: 25px;"><b style="display: inline-block;vertical-align: middle;margin: 5px 5px 0px 5px;color: red">*</b><span>联系电话：</span><span><input type="text" name="" class="lxdh"></span></li> <li style="position: relative;padding-left: 25px;"><b style="display: inline-block;vertical-align: middle;margin: 5px 5px 0px 5px;color: red">*</b><span>填报时间：</span><span><input type="text" name="" class="tbsj" onclick="laydate({istime: true, format: \'YYYY-MM-DD hh:mm:ss\'})"></span></li></ul>',
//                area:['350px','270px'],
//
//                btn1:function (index) {
//                    var xz = $('.qyxz').val();
//                    var tbr = $('.tbr').val();
//                    var lxdh = $('.lxdh').val();
//                    var tbsj = $('.tbsj').val();
//                    if(xz !='' && tbr !='' && lxdh != '' && tbsj !=''){
//                        window.location.href="stoneGardenFigure"+ xz +"?tbr="+ tbr +"&lxdh="+ lxdh +"&tbsj="+tbsj;
//                    } else {
//                        $.layerMsg({content: '内容不能为空', icon: 7});
//                        return false;
//                    }
//                }
//            })
        }
        function hyfl(){
            $.ajax({
                url:'/code/GetDropDownBox?CodeNos=enterprise',
                typeOf:'json',
                data:{},
                type:'get',
                success:function(obj){
                    var str = '<option value="">请选择</option>';
                    var data = obj.enterprise;
                    for(var i=0;i<data.length;i++){
                        str += '<option value="'+ data[i].codeNo +'">'+ data[i].codeName +'</option>'
                    }
                    $('.mainDatas select[name=einfoDigest]').html(str);
                    $('.mainDatas1 select[name=einfoDigest]').html(str);
                }
            })
            $.ajax({
                url:'/code/GetDropDownBox?CodeNos=enterprisestuts',
                typeOf:'json',
                data:{},
                type:'get',
                success:function(obj){
                    var str = '<option value="">请选择</option>';
                    var data = obj.enterprisestuts;
                    for(var i=0;i<data.length;i++){
                        str += '<option value="'+ data[i].codeNo +'">'+ data[i].codeName +'</option>'
                    }
                    $('#ztlx').html(str);
                    $('.mainDatas select[name=einfoStuts]').html(str);
                    $('.mainDatas1 select[name=einfoStuts]').html(str);
                }
            })
        }

        function searchfuc(e){
            var dataid = $('.index_head .one').parent().attr('data_id');
            ajaxform(dataid);
        }
        function ajaxform(dataid){
            if(dataid == 1){
                var obj=$.tablePage('#pagediv',arr,function (me) {
                    me.data.pageSize = 10;
                    me.init('/fixForm/selectFormList?type=1&code='+$('#ztlx').val()+'&gridCode='+$('#gridName').val(),['查看','修改'],function(json){
                        if(json.total > 10){
                            $('#dbgz_page').show();
                        }else{
                            $('#dbgz_page').hide();
                        }
                    });
                });
            }else if(dataid == 2){
                var obj=$.tablePage('#pagediv',arr1,function (me) {
                    me.data.pageSize = 10;
                    me.init('/fixForm/selectFormList?type=2&code='+$('#ztlx').val()+'&gridCode='+$('#gridName').val(),['查看','修改'],function(json){
                        if(json.total > 10){
                            $('#dbgz_page').show();
                        }else{
                            $('#dbgz_page').hide();
                        }
                    });
                });
            }else if(dataid == 3){
                var obj=$.tablePage('#pagediv',arr2,function (me) {
                    me.data.pageSize = 10;
                    me.init('/fixForm/selectFormList?type=3&code='+$('#ztlx').val()+'&gridCode='+$('#gridName').val(),['查看','修改'],function(json){
                        if(json.total > 10){
                            $('#dbgz_page').show();
                        }else{
                            $('#dbgz_page').hide();
                        }
                    });
                });
            }else if(dataid == 4){
                var obj=$.tablePage('#pagediv',arr3,function (me) {
                    me.data.pageSize = 10;
                    me.init('/fixForm/selectFormList?type=4&code='+$('#ztlx').val()+'&gridCode='+$('#gridName').val(),['查看','修改'],function(json){
                        if(json.total > 10){
                            $('#dbgz_page').show();
                        }else{
                            $('#dbgz_page').hide();
                        }
                    });
                });
            }else if(dataid == 5){
                var obj=$.tablePage('#pagediv',arr4,function (me) {
                    me.data.pageSize = 10;
                    me.init('/fixForm/selectFormList?type=5&code='+$('#ztlx').val()+'&gridCode='+$('#gridName').val(),['查看','修改'],function(json){
                        if(json.total > 10){
                            $('#dbgz_page').show();
                        }else{
                            $('#dbgz_page').hide();
                        }
                    });
                });
            }
        }
    </script>
    <script>
        $(function(){
            $('.index_head').on('click','li',function(){
                $(this).find('span').addClass('one').parent().siblings().find('span').removeClass('one');
                var dataid = $(this).attr('data_id');
                $('#ztlx').val('')
                $('#gridName').val('')
                ajaxform(dataid)
            });

            hyfl();
            var obj=$.tablePage('#pagediv',arr,function (me) {
                me.data.pageSize = 10;
                me.init('/fixForm/selectFormList?type=1',['查看','修改'],function(json){
                    if(json.total > 10){
                        $('#dbgz_page').show();
                    }else{
                        $('#dbgz_page').hide();
                    }
                })
            });
            $(document).on('click','.editAndDelete0',function () {
                var datas=JSON.parse($(this).attr('data-obj').replace(/'/g,'"'));
                var type = $('.index_head .one').parent().attr('data_id');
                if(type == 1){
                    var fixFromId = datas.generalSafetyUnitId;
                }else if(type == 2){
                    var fixFromId = datas.smallScaleSecurityUnitId;
                }else if(type == 3){
                    var fixFromId = datas.lid;
                }else if(type == 4){
                    var fixFromId = datas.sid;
                }else if(type == 5){
                    var fixFromId = datas.itemId
                }
                window.location.href="stoneGardenFigure"+type+"?types=2&fixFromId="+fixFromId;
            })
            $(document).on('click','.editAndDelete1',function () {
                var datas=JSON.parse($(this).attr('data-obj').replace(/'/g,'"'));
                var type = $('.index_head .one').parent().attr('data_id');
                if(type == 1){
                    var fixFromId = datas.generalSafetyUnitId;
                }else if(type == 2){
                    var fixFromId = datas.smallScaleSecurityUnitId;
                }else if(type == 3){
                    var fixFromId = datas.lid;
                }else if(type == 4){
                    var fixFromId = datas.sid;
                }else if(type == 5){
                    var fixFromId = datas.itemId
                }
                window.location.href="stoneGardenFigure"+type+"?types=1&fixFromId="+fixFromId;

            })
            $(document).on('click','.editAndDelete2',function (){
                var t = $(this);
                console.log(t);
                var datas=JSON.parse($(this).attr('data-obj').replace(/'/g,'"'));
                var type = $('.index_head .one').parent().attr('data_id');
                if(type == 1){
                    var fixFromId = datas.generalSafetyUnitId;
                }else if(type == 2){
                    var fixFromId = datas.smallScaleSecurityUnitId;
                }else if(type == 3){
                    var fixFromId = datas.lid;
                }else if(type == 4){
                    var fixFromId = datas.sid;
                }else if(type == 5){
                    var fixFromId = datas.itemId
                }
                $.layerConfirm({title:'确定删除',content:'您确定要删除吗？',icon:0},function(){
                    $.ajax({
                        url:'/fixForm/deleteByExamplebyId',
                        typeOf:'json',
                        data:{
                            type:type,
                            fixFromId:fixFromId
                        },
                        type:'get',
                        success:function(data){
                            if(data.flag){
                                console.log(t);
                                t.parents('tr').remove();
                            }else{
                                alert('删除失败！');
                            }
                        }
                    })
                })
            })


            $('.mainDatas .dwbtn').click(function () {
                window.open('/street/mapCoordinates?type=2')
            })
            $('.mainDatas1 .dwbtn').click(function () {
                window.open('/street/mapCoordinates?type=3')
            })

        })

        function theEchozuobiao(str) {
            $('.mainDatas [name="einfoFix"]').val(str)
        }
        function theEchozuobiaos(str) {
            $('.mainDatas1 [name="einfoFix"]').val(str)
        }
        function filechang() {
            $.upload($('#fileload'),function (c) {
                $.layerMsg({content:'<fmt:message code="menuSSetting.th.importSuccess" />',icon:1})
                var file = $("#fileload")
                file.after(file.clone().val(""));
                file.remove();
            })
        }

        $(document).on('click','#checkedAll',function(){
            var state =$(this).prop("checked");
            if(state==true){
                $(this).prop("checked",true);
                $(".checkChild").prop("checked",true);
            }else{
                $(this).prop("checked",false);
                $(".checkChild").prop("checked",false);

            }
        });

        $(document).on('click','#deletes',function () {
            var t = $(this);
            var type = $('.index_head .one').parent().attr('data_id');
            var text=[];
            $(".checkChild").each(function() {
                if ($(this).attr("checked")) {
                    text.push($(this).attr('data-id'));
                }
            });
            var strs=text.join(',');
            $.layerConfirm({title:'确定删除',content:'您确定要删除吗？',icon:0},function(){
                $.ajax({
                    url:'/fixForm/deleteByIds',
                    typeOf:'json',
                    data:{
                        typeId:type,
                        ids:strs
                    },
                    type:'post',
                    success:function(data){
                        if(data.flag){
                            layer.msg('删除成功',{icon: 1,time: 1000});
                                ajaxform(type)
                        }else{
                            alert('删除失败！');
                        }
                    }
                })
            })

        })


    </script>
</body>
</html>
